package com.nxn.security.shiro.realm;

import javax.sql.DataSource;

import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.springframework.beans.factory.annotation.Autowired;

public class SecurityJdbcRealm extends JdbcRealm {

    @Autowired
	private DataSource datasource;
    
	public SecurityJdbcRealm() {
		
		super();

//        InitialContext ic;
//        DataSource dataSource;
//		try {
//			
//			ic = new InitialContext();
//			dataSource = (DataSource) ic.lookup("java:/comp/env/jdbc/security");
//			this.setDataSource(dataSource);
//			
//		} catch (NamingException e) {
//			
//			e.printStackTrace();
//			
//		}
		this.setDataSource(datasource);
	}

}
